[#ftl]
[#include "NavigatorPane.ftl"/]

[#include "MetadataWorkspace.ftl"/]

[#include "MockupWorkspace.ftl"/]

[#include "WidgetWorkspace.ftl"/]

[#include "SitemapPane.ftl"/]

[#include "AnimationKeyframeEditor.ftl"/]

[#assign templateString][#compress]
<div style="padding:0px;width:100%;height:100%;">	
	<div data-dojo-attach-point="container" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props='design:"headline",liveSizing:false,persist:true,style:"padding:0px;width:100%;height:100%;"'> 
		[#--/*
		<div data-dojo-type="agile.NavigatorPane" data-dojo-props='region:"top",style:"margin:0px;padding:0px;border:0px"'></div>
		
		<div data-dojo-type="dijit.layout.BorderContainer" data-dojo-attach-point="mainWorkspace" id="mainWorkspace" data-dojo-props='region:"center",design:"headline",style:"margin:0px;padding:0px;padding-left:1px;border:0px"'>						
		
			<div data-dojo-id="leadingPane" data-dojo-type="agile.WidgetWorkspace" data-dojo-props='region:"leading",splitter:false,duration:200,style:"width:145px"'>
				<div data-dojo-type="agile.WidgetIconPane" data-dojo-props='store:"agile.widget-all",title:"{i18n_Common_Widgets}",selected:true'></div>			
				<div data-dojo-type="agile.TemplateIconPane" data-dojo-props='title:"{i18n_My_Widgets}"'></div>				
			</div>	
		
			<div data-dojo-type="agile.MetadataWorkspace" data-dojo-props='floatingContainer:"mainWorkspace",region:"trailing",splitter:false,class:"bp_hidden"'></div>
		
			<div data-dojo-type="agile.SitemapPane"  data-dojo-props='floatingContainer:"mainWorkspace",region:"trailing",splitter:false,class:"bp_hidden"'></div>
			<div data-dojo-type="agile.WidgetIconPane" data-dojo-props='floatingContainer:"mainWorkspace",region:"trailing",splitter:false,class:"bp_hidden",store:"agile.widget-all",title:"{i18n_Common_Widgets}",selected:true'></div>
			<div data-dojo-type="agile.TemplateIconPane" data-dojo-props='floatingContainer:"mainWorkspace",region:"trailing",splitter:false,class:"bp_hidden",title:"{i18n_My_Widgets}"'></div>
			
			<div data-dojo-type="agile.MockupWorkspace" jsId="mockupWorkspace" data-dojo-props='region:"center",style:"margin:0px;padding:0px;border:0px"'></div>
		
		</div>
		*/--]
	</div>
<div>[/#compress]
[/#assign]
[@define "agile.Application" "_WidgetBase,_TemplatedMixin,_WidgetsInTemplateMixin,agile._i18nTemplateMixin" "Menu=dijit/Menu"]
	 	templateString:"${templateString?js_string}"
 	 	,constructor:function(){
 	 		aspect.after(this,"startup",lang.hitch(this,"init")); 	 		
 	 	}
		,addChild:function(child){
			this.container.addChild(child);
		}
		,postCreate:function(){
			if(window.NavigatorPane){
				this.addChild(window.NavigatorPane)
			}			
			if(window.MockupWorkspace) {
				this.addChild(window.MockupWorkspace);			
			}
		}
 		,init:function(){
 			console.log("Application startup");
 			
 			aspect.after(window,"onresize",lang.hitch(this,function(){
 				this.container.resize();
 			}));
 			
 			var app = this;
 			app.childWidgets = {};
 			
 			array.forEach(this.container.getChildren(),function(child){
 				app.childWidgets[child.get("id")] = child;
 			});
 						
 			var container= this.container;

			
 			//to disable popup menu of the browser
 			var contextMenu = new Menu({targetNodeIds: [_window.body()]});
 			contextMenu.on("open",function(){
 				style.set(contextMenu.domNode,"display","none");
 			});
			
 			topic.publish("agile.ready","Application");
// 			topic.publish("agile.message","error",null,"test the message dialog","failed to upload file");
 		}
[/@]


[@bootstrapChains "Step3/3 Initializing Navigator Pane"]
  window.NavigatorPane = new agile.NavigatorPane({
  	region:"top",
  	style:"margin:0px;padding:0px;border:0px"			
  });
[/@]

[@bootstrapChains "Step3/3 Initializing Mockup Workspace"]
 window.MockupWorkspace = new agile.MockupWorkspace({
 	 region:"center"
 	 ,style:"margin:0px;padding:0px;border:0px"
 	 ,id:"mainWorkspace"
 });
[/@] 
   